package com.mdd.admin.validate.course;

import com.mdd.admin.validate.BaseParam;
import com.mdd.common.validator.annotation.IDMust;
import com.mdd.common.validator.annotation.IntegerContains;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import lombok.Data;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;

/**
 * 课程参数
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CourseParam extends BaseParam {

    @IDMust(message = "id参数必传且需大于0", groups = {update.class, delete.class, change.class})
    private Integer id;

    @NotNull(message = "type参数缺失", groups = {create.class, update.class})
//    @DecimalMin(value = "0", message = "type参数值不能少于0", groups = {create.class, update.class})
    @IntegerContains(values = {1, 2, 3, 4}, message = "type参数值不在符合范围", groups = {create.class, update.class})
    private Integer type;

    @NotNull(message = "name参数缺失", groups = {create.class, update.class})
    @NotEmpty(message = "名称不能为空", groups = {create.class, update.class})
    @Length(max = 128, message = "名称不能超出128个字符", groups = {create.class, update.class})
    private String name;

    @NotNull(message = "categoryId参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "categoryId参数值不能少于0", groups = {create.class, update.class})
    private Integer categoryId;

    @NotNull(message = "teacherId参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "teacherId参数值不能少于0", groups = {create.class, update.class})
    private Integer teacherId;

//    @NotNull(message = "synopsis参数缺失", groups = {create.class, update.class})
//    @NotEmpty(message = "课程简介不能为空", groups = {create.class, update.class})
    @Length(max = 255, message = "课程简介不能超出255个字符", groups = {create.class, update.class})
    private String synopsis;

    @NotNull(message = "cover参数缺失", groups = {create.class, update.class})
    @Length(max = 128, message = "cover参数不能超出128个字符", groups = {create.class, update.class})
    private String cover;

    private String content;

//    @NotNull(message = "feeType参数缺失", groups = {create.class, update.class})
//    @DecimalMin(value = "0", message = "feeType参数值不能少于0", groups = {create.class, update.class})
    @IntegerContains(values = {0, 1}, message = "feeType参数值不在符合范围", groups = {create.class, update.class})
    private Integer feeType = 1;

//    @NotNull(message = "sellPrice参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "售价不能少于0", groups = {create.class, update.class})
    private BigDecimal sellPrice;

//    @NotNull(message = "linePrice参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "划线价不能少于0", groups = {create.class, update.class})
    private BigDecimal linePrice;

//    @NotNull(message = "virtualStudyNum参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "虚拟学习人数不能少于0", groups = {create.class, update.class})
    private Integer virtualStudyNum = 0;

//    @NotNull(message = "studyNum参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "学习人数不能少于0", groups = {create.class, update.class})
    private Integer studyNum;

    @NotNull(message = "status参数缺失", groups = {create.class, update.class})
//    @DecimalMin(value = "0", message = "status参数值不能少于0", groups = {create.class, update.class})
    @IntegerContains(values = {0, 1}, message = "status参数值不在符合范围", groups = {create.class, update.class})
    private Integer status;

//    @NotNull(message = "isChoice参数缺失", groups = {create.class, update.class})
    @IntegerContains(values = {0, 1}, message = "isChoice参数值不在符合范围", groups = {create.class, update.class})
    private Integer isChoice = 0;

//    @NotNull(message = "sort参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "排序值不能少于0", groups = {create.class, update.class})
    private Integer sort;

    @NotNull(message = "images参数缺失", groups = {create.class, update.class})
    @NotEmpty(message = "images is not empty", groups = {create.class, update.class})
    private List<String> images;

}
